package com.cglib;

import org.springframework.asm.ClassReader;
import org.springframework.asm.ClassVisitor;
import org.springframework.asm.MethodVisitor;
import org.springframework.asm.Opcodes;

import java.io.IOException;

/**
 * @author fanxiao  2022/7/15
 * @since 1.0.0
 */
interface TestService {

	Double test(String name, Long number);

}

class TestServiceClassVisitor extends ClassVisitor {
	public TestServiceClassVisitor() {
		super(Opcodes.ASM7);
	}

	@Override
	public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
		return new TestServiceMethodVisitor();
	}
}

class TestServiceMethodVisitor extends MethodVisitor {
	public TestServiceMethodVisitor() {
		super(Opcodes.ASM7);
	}

	@Override
	public void visitParameter(String name, int access) {
		System.out.println("name:" + name);
	}
}

class TestServiceTest {
	public static void main(String[] args) throws IOException {
		TestServiceClassVisitor classVisitor = new TestServiceClassVisitor();
		ClassReader classReader = new ClassReader(TestService.class.getName());
		classReader.accept(classVisitor, 0);
	}
}